import java.util.ArrayList;
import java.util.Iterator;



public class ArrayListCheck{
	public static void main(String[] ar){
		
		Me obj1=new Me("Damu");
		Frd frd1=new Frd("Ashok");
		Frd frd2=new Frd("Muni");
		ArrayList<Object> al=new ArrayList<Object>();
		al.add(obj1);
		al.add(frd1);
		al.add(frd2);
		System.out.println(al);
		Iterator itr=(Iterator) al.iterator();
		Me ref=(Me)itr.next();
		System.out.println(ref.getName());
		
		
	}

}

class Me{
	private String name;
	Me(String name){
	this.name=name;
	}
	public String getName(){
		return name;
	}
}


class Frd{
	private String name;
	Frd(String name){
	this.name=name;
	}
}
